Skip to content

Add Range#265

Merged
waynemwashuma merged 1 commit intowimaengine:devfrom
waynemwashuma:add-range
Sep 20, 2025
Merged

Add Range#265
waynemwashuma merged 1 commit intowimaengine:devfrom
waynemwashuma:add-range

Conversation

@waynemwashuma
Copy link
Collaborator

@waynemwashuma waynemwashuma commented Sep 20, 2025

Objective

Introduces a new Range utility. It provides a convenient abstraction for working with numerical intervals, making it easier to perform interpolation and other range-based operations across the codebase.

Solution

Added a new Range class which:

  • Supports defining a numeric range with start and end values.
  • Provides a valid() method to ensure the range is properly ordered (start <= end).
  • Implements lerp() to interpolate between start and end using a normalized value.

Showcase

Defining and interpolating over a range:

const r = new Range(0, 10)

console.log(r.valid()) // true
console.log(r.lerp(0.5)) // 5

Migration guide

No breaking changes introduced.

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@waynemwashuma waynemwashuma self-assigned this Sep 20, 2025
@waynemwashuma waynemwashuma added type:enhancement New feature or request mod:datastructure This PR/issue affects datastructure package labels Sep 20, 2025
@waynemwashuma waynemwashuma marked this pull request as ready for review September 20, 2025 21:23
@waynemwashuma waynemwashuma merged commit ed9e00c into wimaengine:dev Sep 20, 2025
5 checks passed
@waynemwashuma waynemwashuma deleted the add-range branch September 20, 2025 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:datastructure This PR/issue affects datastructure package type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant